package com.redrose.flutterdemo.utils;

import android.os.Environment;

import java.io.File;

/**
 * 路径工具类
 */

public class PathUtil {
    /**
     * 获取日子保存路径
     */
    public static String getLogPath() {
        //获取手机本身存储根目录Environment.getExternalStoragePublicDirectory("")
        //sd卡根目录Environment.getExternalStorageDirectory()
        return Environment.getExternalStorageDirectory().getPath() + File.separator
                + ConstantUtil.APP_NAME + File.separator + "logFile"
                + File.separator;
    }

    /**
     * 获取工程目录
     *
     * @return
     */
    public static String getAppDocPath() {
        return Environment.getExternalStorageDirectory().getPath() + File.separator
                + ConstantUtil.APP_NAME
                + File.separator;
    }

    public static String getAppPicPath() {
        return Environment.getExternalStorageDirectory().getPath() + File.separator
                + ConstantUtil.APP_NAME + File.separator + "pics"
                + File.separator;
    }
    public static String getAppAudioPath() {
        return Environment.getExternalStorageDirectory().getPath() + File.separator
                + ConstantUtil.APP_NAME + File.separator + "audio"
                + File.separator;
    }
    public static String getAppVideoPath() {
        return Environment.getExternalStorageDirectory().getPath() + File.separator
                + ConstantUtil.APP_NAME + File.separator + "video"
                + File.separator;
    }
    /**
     * 判断是否插入sd卡
     */
    public static boolean judageSDIsExist(){
        return Environment.getExternalStorageState().equals(
                android.os.Environment.MEDIA_MOUNTED);
    }
}
